<template>
  <view class="group_5 flex-col" style="">
    <view class="section_10 flex-row justify-between">
      <view class="image-text_26 flex-col" @click="switchTab('/pages/index/index')">
        <image class="thumbnail_13" referrerpolicy="no-referrer" src="/static/img/1a.png" v-if="index == 1" />
        <image class="thumbnail_13" src="/static/img/1.png" v-else />
        <text class="text-group_8" :class="{ actt: index == 1 }">首页</text>
      </view>

      <view class="image-text_26 flex-col" @click="switchTab('/pages/user/index')">
        <image class="thumbnail_13" v-if="index == 2" src="/static/img/2a.png" />
        <image class="thumbnail_13" src="/static/img/2.png" v-else />
        <text class="text-group_8" :class="{ actt: index == 2 }">我的</text>
      </view>
    </view>

    <image class="label_1" @click="addProuct" src="/static/index/1243.png" />
  </view>
</template>

<script>
export default {
  props: ['index'],
  data() {
    return {
      userInfo: {}
    }
  },
  onLoad() {},
  components: {},

  methods: {
    addProuct() {
      this.$http({
        url: 'getUserInfo'
      }).then(res => {
        this.$db.setUser(res.data.myself)
        this.userInfo = res.data.myself
        if (!this.userInfo.id) {
          return uni.showModal({
            title: '提示',
            content: '该账号已经被禁用',
            showCancel: false
          })
        }
        if (this.userInfo.realname_verify == 0) {
          return uni.showModal({
            title: '提示',
            content: '请完善个人真实信息',
            confirmText: '去完善',
            success: res => {
              if (res.confirm) {
                uni.navigateTo({
                  url: '/pages/realNameAuthentication/index'
                })
              }
            }
          })
        } else {
          this.$to('/pages/publish/index')
        }
      })
    },
    switchTab(url) {
      this.$http({
        url: 'getUserInfo'
      }).then(res => {
        this.$db.setUser(res.data.myself)
        this.userInfo = res.data.myself
        if (!this.userInfo.id) {
          return uni.showModal({
            title: '提示',
            content: '该账号已经被禁用',
            showCancel: false
          })
        }
        uni.switchTab({
          url: url
        })
      })
    }
  }
}
</script>

<style lang="scss" scoped>
@import '../pages/common/common.css';
.group_5 {
  height: 60px;
  background: url('../static/img/tbac.png') 100% no-repeat;
  background-size: 100% 100%;
  width: 100%;
  position: fixed;
  left: 0;
  bottom: 0;
  padding: 16rpx 106rpx;
  box-sizing: border-box;
  z-index: 1000;
}

.section_10 {
  width: 85%;
  margin: 0 auto;
}

.thumbnail_13 {
  width: 25px;
  height: 25px;
  display: block;
}

.text-group_8 {
  font-size: 12px;
  text-align: center;
  margin-top: 5px;
}
.actt {
  color: rgba(254, 55, 60, 1);
}
.label_1 {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -35px;
  width: 88rpx;
  height: 88rpx;
}
</style>
